<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <!-- 2.准备容器 -->
    <div id="app">
      <div @click="father()">
        父元素
        <!-- .stop   阻止父元素事件冒泡 -->
        <button @click.stop="son()">子元素</button>
      </div>
      <a href="https://itheima.com" @click.prevent>黑马</a>
    </div>

    <!-- 1.导入 vue.js -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

    <!-- 3.创建Vue实例对象 -->
    <script>
      const app = new Vue({
        // 容器
        el: "#app",
        // 数据
        data: {
          
        },
        methods:{
          father(){
            alert('父元素')
          },
          son(){
            alert('子元素')
          }
        }
      });
    </script>
  </body>
</html>
